

-- procedure to modify a user with no password
-- returns 1 if can modify, 0 cannot modify
IF OBJECT_ID('modifyUserNoPassword') IS NOT NULL
BEGIN
	DROP PROCEDURE modifyUserNoPassword;
END
GO
CREATE PROCEDURE modifyUserNoPassword
	@UserId			INT,
	@FirstName		VARCHAR(50),
	@LastName		VARCHAR(50),
	@Gender			VARCHAR(6),
	@Address		VARCHAR(200),
	@UserName		VARCHAR(30),
	@UserType		VARCHAR(20)
AS
BEGIN
	IF EXISTS(SELECT * FROM users WHERE userid=@UserId)
		BEGIN
			UPDATE users SET firstname=@FirstName, lastname=@LastName, gender=@Gender, [address]=@Address, 
			username=@UserName, usertype=@UserType WHERE userid =@UserId;
			SELECT 1;
		END
	ELSE
		BEGIN
			SELECT 0;
		END
END
GO